let utils = require("./modules/utils.js");
let config = require("./modules/config");
let system = require("./modules/system");

app.launchApp(config.targetAppName);
sleep(3000); // 等待加载
// utils.getGoodsOrderImage("456456645","111111")
// utils.searchOrder("654456654")
// utils.countWidget(descMatches, /未选择.+/)
// utils.forceFindControl({functionName: descMatches, text: /未选择.+/, index: 0, awaitTime: 5000,excludeClassNames:[]})
// sleep(300);
// utils.forceFindControl({functionName: descMatches, text: /未选择.+/, index: -1, awaitTime: 5000,excludeClassNames:[]})// utils.forceFindControl({functionName: textMatches, text: ".*我的订单.*"})
// utils.forceFindControl({functionName: className, text: "Button", click: true, awaitTime: 5000})
var jc1 = utils.forceFindControl({
    functionName: textMatches,
    text: /.*(操作过于频繁|访问被拒绝).*/,

    awaitTime: 5000
});
if (jc1) {
    sleep(3000);
    utils.forceFindControl({
        functionName: text,
        text: "确定",
        double_click: true,
        click: true,
        awaitTime: 3000
    });

    var jc2 = utils.forceFindControl({
        functionName: textMatches,
        text: /.*(操作过于频繁|访问被拒绝).*/,

        awaitTime: 5000
    });
    if (jc2) {
        utils.forceFindControl({
            functionName: text,
            text: "确定",
            click: true,
            awaitTime: 3000
        });
    }
}
// sleep(5000);className('com.bytedance.ies.xelement.input.LynxInputViewLegacy')
// setClip("12355556");
// click(config.pos1.x, config.pos1.y)
// sleep(2000);
// click(config.pos2.x, config.pos2.y)
// toastLog(aa.setText("_string"))
toastLog("全部任务执行完成！");

